d3d10/effect: Release technique names on Optimize().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-12 16:37:00 +03:00 committed by Alexandre Julliard
parent d2d161d507
commit eb1f76caa6
2 changed files with 23 additions and 0 deletions

View File

@ -3435,6 +3435,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
v->u.shader.stream_output_declaration = NULL;
}
for (i = 0; i < effect->technique_count; ++i)
{
heap_free(effect->techniques[i].name);
effect->techniques[i].name = NULL;
}
return S_OK;
}

View File

@ -5996,6 +5996,8 @@ static void test_effect_optimize(void)
{
D3D10_EFFECT_SHADER_DESC shaderdesc;
ID3D10EffectShaderVariable *gs;
D3D10_TECHNIQUE_DESC tech_desc;
ID3D10EffectTechnique *tech;
ID3D10EffectVariable *v;
ID3D10Effect *effect;
ID3D10Device *device;
@ -6011,6 +6013,11 @@ static void test_effect_optimize(void)
hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
ok(SUCCEEDED(hr), "Failed to create an effect.\n");
tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!strcmp(tech_desc.Name, "Render"), "Unexpected technique name %s.\n", tech_desc.Name);
v = effect->lpVtbl->GetVariableByName(effect, "g_so");
gs = v->lpVtbl->AsShader(v);
@ -6038,6 +6045,16 @@ static void test_effect_optimize(void)
ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
ok(!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(!tech_desc.Name, "Unexpected technique name %p.\n", tech_desc.Name);
tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
ok(tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");
tech = effect->lpVtbl->GetTechniqueByName(effect, "Render");
ok(!tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);