From b6062279b88650104918a9004a631e24be87a87b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 7 Feb 2022 17:24:32 -0600 Subject: [PATCH] d3dx9: Return D3DERR_INVALIDCALL from ID3DXEffect::BeginPass() if the effect is not started. Signed-off-by: Zebediah Figura Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dx9_36/effect.c | 6 ++++++ dlls/d3dx9_36/tests/effect.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 22afa649db3..e623c10035a 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -4001,6 +4001,12 @@ static HRESULT WINAPI d3dx_effect_BeginPass(ID3DXEffect *iface, UINT pass) TRACE("iface %p, pass %u\n", effect, pass); + if (!effect->started) + { + WARN("Effect is not started, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + if (technique && pass < technique->pass_count && !effect->active_pass) { HRESULT hr; diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index ea90299f936..d4efc1101d9 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -3081,6 +3081,12 @@ static void test_effect_states(IDirect3DDevice9 *device) NULL, NULL, 0, NULL, &effect, NULL); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr); + hr = effect->lpVtbl->End(effect); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + + hr = effect->lpVtbl->BeginPass(effect, 0); + ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); + /* State affected in passes saved/restored even if no pass was performed. States not present in passes are not saved & restored */