Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 12 +++++------- dlls/d3d10/tests/effect.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index daca3379fde..6fec572d692 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -9254,17 +9254,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_sampler_variable_GetSampler(ID3D10
TRACE("iface %p, index %u, sampler %p.\n", iface, index, sampler);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); - else if (index) - return E_FAIL; - - if (v->type->basetype != D3D10_SVT_SAMPLER) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a sampler state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->samplers))) + return E_FAIL; + if ((*sampler = v->u.state.object.sampler)) ID3D10SamplerState_AddRef(*sampler);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 84a2abcb4d9..5ca6b539524 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4446,6 +4446,7 @@ static void test_effect_state_groups(void) ID3D10EffectBlendVariable *b; D3D10_BLEND_DESC blend_desc; D3D10_STATE_BLOCK_MASK mask; + ID3D10SamplerState *sampler; D3D10_PASS_DESC pass_desc; ID3D10EffectVariable *v; ID3D10EffectPass *pass; @@ -4496,9 +4497,19 @@ static void test_effect_state_groups(void) ok(sampler_desc.BorderColor[3] == 4.0f, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc.BorderColor[3]); ok(sampler_desc.MinLOD == 6.0f, "Got unexpected MinLOD %.8e.\n", sampler_desc.MinLOD); ok(sampler_desc.MaxLOD == 5.0f, "Got unexpected MaxLOD %.8e.\n", sampler_desc.MaxLOD); + hr = s->lpVtbl->GetSampler(s, 0, &sampler); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10SamplerState_GetDesc(sampler, &sampler_desc); + ok(sampler_desc.Filter == D3D10_FILTER_MIN_MAG_MIP_LINEAR, "Got unexpected Filter %#x.\n", sampler_desc.Filter); + ID3D10SamplerState_Release(sampler);
s->lpVtbl->GetBackingStore(s, 1, &sampler_desc); ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_MIRROR, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU); + hr = s->lpVtbl->GetSampler(s, 1, &sampler); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10SamplerState_GetDesc(sampler, &sampler_desc); + ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_MIRROR, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU); + ID3D10SamplerState_Release(sampler);
v = effect->lpVtbl->GetVariableByName(effect, "blend_state"); b = v->lpVtbl->AsBlend(v);