Nikolay Sivov : d3d10/effect: Fix iteration in GetBackingStore() for blend states.

Alexandre Julliard julliard at winehq.org
Thu Jan 20 15:44:48 CST 2022


Module: wine
Branch: master
Commit: 50830170eb40dcef6542602186d4cba1c5353872
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=50830170eb40dcef6542602186d4cba1c5353872

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Jan 19 13:29:09 2022 +0300

d3d10/effect: Fix iteration in GetBackingStore() for blend states.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 25d6056750e..a6a1189be20 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -8555,21 +8555,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_blend_variable_GetBackingStore(ID3
 
     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_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;
+
     *desc = v->u.state.desc.blend;
 
     return S_OK;
 }
 
-
 static const struct ID3D10EffectBlendVariableVtbl d3d10_effect_blend_variable_vtbl =
 {
     /* ID3D10EffectVariable methods */
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index db4bebc0ce6..418747b5df5 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -4519,6 +4519,8 @@ 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]);
+    b->lpVtbl->GetBackingStore(b, 1, &blend_desc);
+    ok(blend_desc.SrcBlend == D3D10_BLEND_SRC_COLOR, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
 
     v = effect->lpVtbl->GetVariableByName(effect, "ds_state");
     d = v->lpVtbl->AsDepthStencil(v);




More information about the wine-cvs mailing list