Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 11 +++++------ dlls/d3d10/tests/effect.c | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index a6a1189be20..3198ad5a575 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -8796,21 +8796,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingS
TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); - - if (v->type->basetype != D3D10_SVT_DEPTHSTENCIL) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a depth stencil state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->ds_states))) + return E_FAIL; + *desc = v->u.state.desc.depth_stencil;
return S_OK; }
- static const struct ID3D10EffectDepthStencilVariableVtbl d3d10_effect_depth_stencil_variable_vtbl = { /* ID3D10EffectVariable methods */ diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 418747b5df5..93ad4d8a475 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4548,6 +4548,8 @@ static void test_effect_state_groups(void) ds_desc.BackFace.StencilPassOp); ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_GREATER_EQUAL, "Got unexpected BackFaceStencilFunc %#x.\n", ds_desc.BackFace.StencilFunc); + d->lpVtbl->GetBackingStore(d, 1, &ds_desc); + ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
v = effect->lpVtbl->GetVariableByName(effect, "rast_state"); r = v->lpVtbl->AsRasterizer(v);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 11 +++++------ dlls/d3d10/tests/effect.c | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 3198ad5a575..daca3379fde 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -9037,21 +9037,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetBackingStor
TRACE("iface %p, index %u, desc %p.\n", iface, index, desc);
- if (v->type->element_count) - v = impl_from_ID3D10EffectVariable(iface->lpVtbl->GetElement(iface, index)); - - if (v->type->basetype != D3D10_SVT_RASTERIZER) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a rasterizer state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->rs_states))) + return E_FAIL; + *desc = v->u.state.desc.rasterizer;
return S_OK; }
- static const struct ID3D10EffectRasterizerVariableVtbl d3d10_effect_rasterizer_variable_vtbl = { /* ID3D10EffectVariable methods */ diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 93ad4d8a475..84a2abcb4d9 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4567,6 +4567,8 @@ static void test_effect_state_groups(void) ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable); ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n", rast_desc.AntialiasedLineEnable); + r->lpVtbl->GetBackingStore(r, 1, &rast_desc); + ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0"); ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
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);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
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 6fec572d692..fb6c1ed58ad 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -9013,17 +9013,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_rasterizer_variable_GetRasterizerS
TRACE("iface %p, index %u, rasterizer_state %p.\n", iface, index, rasterizer_state);
- 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_RASTERIZER) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a rasterizer state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->rs_states))) + return E_FAIL; + if ((*rasterizer_state = v->u.state.object.rasterizer)) ID3D10RasterizerState_AddRef(*rasterizer_state);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 5ca6b539524..32a154bf276 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4578,8 +4578,19 @@ static void test_effect_state_groups(void) ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable); ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n", rast_desc.AntialiasedLineEnable); + hr = r->lpVtbl->GetRasterizerState(r, 0, &rast_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10RasterizerState_GetDesc(rast_state, &rast_desc); + ok(rast_desc.CullMode == D3D10_CULL_FRONT, "Got unexpected CullMode %#x.\n", rast_desc.CullMode); + ID3D10RasterizerState_Release(rast_state); + r->lpVtbl->GetBackingStore(r, 1, &rast_desc); ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode); + hr = r->lpVtbl->GetRasterizerState(r, 1, &rast_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10RasterizerState_GetDesc(rast_state, &rast_desc); + ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode); + ID3D10RasterizerState_Release(rast_state);
technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0"); ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 12 +++++------- dlls/d3d10/tests/effect.c | 10 ++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index fb6c1ed58ad..96fd994fe77 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -8772,17 +8772,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetDepthSte
TRACE("iface %p, index %u, depth_stencil_state %p.\n", iface, index, depth_stencil_state);
- 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_DEPTHSTENCIL) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a depth stencil state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->ds_states))) + return E_FAIL; + if ((*depth_stencil_state = v->u.state.object.depth_stencil)) ID3D10DepthStencilState_AddRef(*depth_stencil_state);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 32a154bf276..5c2e7766767 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4559,8 +4559,18 @@ static void test_effect_state_groups(void) ds_desc.BackFace.StencilPassOp); ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_GREATER_EQUAL, "Got unexpected BackFaceStencilFunc %#x.\n", ds_desc.BackFace.StencilFunc); + hr = d->lpVtbl->GetDepthStencilState(d, 0, &ds_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc); + ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + ID3D10DepthStencilState_Release(ds_state); d->lpVtbl->GetBackingStore(d, 1, &ds_desc); ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + hr = d->lpVtbl->GetDepthStencilState(d, 1, &ds_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc); + ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable); + ID3D10DepthStencilState_Release(ds_state);
v = effect->lpVtbl->GetVariableByName(effect, "rast_state"); r = v->lpVtbl->AsRasterizer(v);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 12 +++++------- dlls/d3d10/tests/effect.c | 8 ++++++++ 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 96fd994fe77..e3c261d0270 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -8531,17 +8531,15 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBlendState(ID3D1
TRACE("iface %p, index %u, blend_state %p.\n", iface, index, blend_state);
- 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_BLEND) + if (!iface->lpVtbl->IsValid(iface)) { - WARN("Variable is not a blend state.\n"); + WARN("Invalid variable.\n"); return E_FAIL; }
+ if (!(v = d3d10_get_state_variable(v, index, &v->effect->blend_states))) + return E_FAIL; + if ((*blend_state = v->u.state.object.blend)) ID3D10BlendState_AddRef(*blend_state);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 5c2e7766767..9715c00c232 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -4530,8 +4530,16 @@ static void test_effect_state_groups(void) blend_desc.RenderTargetWriteMask[0]); ok(blend_desc.RenderTargetWriteMask[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n", blend_desc.RenderTargetWriteMask[7]); + hr = b->lpVtbl->GetBlendState(b, 0, &blend_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10BlendState_GetDesc(blend_state, &blend_desc); + ok(blend_desc.SrcBlend == D3D10_BLEND_ONE, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend); + ID3D10BlendState_Release(blend_state); b->lpVtbl->GetBackingStore(b, 1, &blend_desc); ok(blend_desc.SrcBlend == D3D10_BLEND_SRC_COLOR, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend); + hr = b->lpVtbl->GetBlendState(b, 1, &blend_state); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ID3D10BlendState_Release(blend_state);
v = effect->lpVtbl->GetVariableByName(effect, "ds_state"); d = v->lpVtbl->AsDepthStencil(v);