d3dx9/effect: Reset output handle for next after last technique in FindNextValidTechnique().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 60a3e01062)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-17 19:17:33 +02:00 committed by Michael Stefaniuc
parent a941df5c12
commit f1589ee006
2 changed files with 12 additions and 7 deletions

View File

@ -3816,7 +3816,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D
} }
} }
*next_technique = get_technique_handle(&effect->techniques[0]); *next_technique = NULL;
return S_FALSE; return S_FALSE;
} }

View File

@ -7892,9 +7892,9 @@ static void test_effect_find_next_valid_technique(void)
D3DPRESENT_PARAMETERS present_parameters = {0}; D3DPRESENT_PARAMETERS present_parameters = {0};
IDirect3DDevice9 *device; IDirect3DDevice9 *device;
D3DXTECHNIQUE_DESC desc; D3DXTECHNIQUE_DESC desc;
D3DXHANDLE tech, tech2;
ID3DXEffect *effect; ID3DXEffect *effect;
IDirect3D9 *d3d; IDirect3D9 *d3d;
D3DXHANDLE tech;
ULONG refcount; ULONG refcount;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
@ -7939,9 +7939,12 @@ static void test_effect_find_next_valid_technique(void)
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); tech2 = tech;
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2);
ok(hr == S_FALSE, "Got result %#x.\n", hr); ok(hr == S_FALSE, "Got result %#x.\n", hr);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc); ok(!tech2, "Unexpected technique handle %p.\n", tech2);
/* Test GetTechniqueDesc() with a NULL handle. */
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech2, &desc);
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name); ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
@ -7957,9 +7960,10 @@ static void test_effect_find_next_valid_technique(void)
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2);
ok(hr == S_FALSE, "Got result %#x.\n", hr); ok(hr == S_FALSE, "Got result %#x.\n", hr);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc); ok(!tech2, "Unexpected technique handle %p.\n", tech2);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech2, &desc);
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name); ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
@ -7985,8 +7989,9 @@ static void test_effect_find_next_valid_technique(void)
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2);
ok(hr == S_FALSE, "Got result %#x.\n", hr); ok(hr == S_FALSE, "Got result %#x.\n", hr);
ok(!tech2, "Unexpected technique handle %p.\n", tech2);
hr = effect->lpVtbl->FindNextValidTechnique(effect, "nope", &tech); hr = effect->lpVtbl->FindNextValidTechnique(effect, "nope", &tech);
ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);