Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Inspired by a patch by Rafał Mużyło.
I'm surprised that this didn't come up earlier.
dlls/d3dx9_36/effect.c | 5 +++-- dlls/d3dx9_36/tests/effect.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index a909d66a92f..94f7b072117 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -4202,7 +4202,7 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW
TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags);
- if (passes && technique) + if (technique) { if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE)) WARN("Invalid flags (%#x) specified.\n", flags); @@ -4234,7 +4234,8 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW ERR("StateBlock Capture failed, hr %#x.\n", hr); }
- *passes = technique->pass_count; + if (passes) + *passes = technique->pass_count; effect->started = TRUE; effect->begin_flags = flags;
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 9a8a9b65fbc..a75b67c7f62 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -3081,7 +3081,7 @@ static void test_effect_states(IDirect3DDevice9 *device) ok(!bval, "Got result %u, expected 0.\n", bval);
hr = IDirect3DDevice9_SetTransform(device, D3DTS_WORLDMATRIX(1), &test_mat); - hr = effect->lpVtbl->Begin(effect, &npasses, 0); + hr = effect->lpVtbl->Begin(effect, NULL, 0); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);