[PATCH 1/6] d3d10/effect: Fix iteration in GetBackingStore() for depth stencil states.

Nikolay Sivov nsivov at codeweavers.com
Fri Jan 21 01:26:23 CST 2022


Signed-off-by: Nikolay Sivov <nsivov at 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);
-- 
2.34.1




More information about the wine-devel mailing list