Commit 01e278a3 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Fix FindNextValidTechnique() when no previous technique is specified.

parent 8dedf244
......@@ -4048,7 +4048,10 @@ static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect *iface,
{
tech = &base->techniques[i];
if (tech == prev_tech)
{
++i;
break;
}
}
}
else
......@@ -4056,7 +4059,7 @@ static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect *iface,
i = 0;
}
for (++i; i < base->technique_count; ++i)
for (; i < base->technique_count; ++i)
{
tech = &base->techniques[i];
if (SUCCEEDED(ID3DXEffectImpl_ValidateTechnique(iface, get_technique_handle(tech))))
......
......@@ -7832,6 +7832,38 @@ static void test_create_effect_from_file(void)
DestroyWindow(window);
}
#if 0
technique tech0
{
pass p0
{
LightEnable[0] = FALSE;
FogEnable = FALSE;
}
}
technique tech1
{
pass p0
{
LightEnable[0] = TRUE;
FogEnable = TRUE;
}
}
#endif
static const DWORD test_two_techniques_blob[] =
{
0xfeff0901, 0x000000ac, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000030,
0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000000, 0x00000002, 0x00000002,
0x00000001, 0x0000004c, 0x00000000, 0x00000001, 0x00000044, 0x00000000, 0x00000002, 0x00000091,
0x00000000, 0x00000008, 0x00000004, 0x0000000e, 0x00000000, 0x00000028, 0x00000024, 0x000000a0,
0x00000000, 0x00000001, 0x00000098, 0x00000000, 0x00000002, 0x00000091, 0x00000000, 0x0000005c,
0x00000058, 0x0000000e, 0x00000000, 0x0000007c, 0x00000078, 0x00000000, 0x00000000,
};
static void test_effect_find_next_valid_technique(void)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
......@@ -7868,6 +7900,30 @@ static void test_effect_find_next_valid_technique(void)
return;
}
hr = D3DXCreateEffectEx(device, test_two_techniques_blob, sizeof(test_two_techniques_blob),
NULL, NULL, NULL, 0, NULL, &effect, NULL);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
ok(hr == S_FALSE, "Got result %#x.\n", hr);
hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
effect->lpVtbl->Release(effect);
hr = D3DXCreateEffectEx(device, test_effect_unsupported_shader_blob, sizeof(test_effect_unsupported_shader_blob),
NULL, NULL, NULL, 0, NULL, &effect, NULL);
ok(hr == D3D_OK, "Got result %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment