Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 8 +++++++- dlls/d3d10/tests/effect.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index d850928248a..a9e97725659 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3413,7 +3413,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface) { struct d3d10_effect *effect = impl_from_ID3D10Effect(iface); struct d3d10_effect_variable *v; - unsigned int i; + unsigned int i, j;
FIXME("iface %p semi-stub!\n", iface);
@@ -3437,6 +3437,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
for (i = 0; i < effect->technique_count; ++i) { + for (j = 0; j < effect->techniques[i].pass_count; ++j) + { + heap_free(effect->techniques[i].passes[j].name); + effect->techniques[i].passes[j].name = NULL; + } + heap_free(effect->techniques[i].name); effect->techniques[i].name = NULL; } diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index b560b47f8a9..9709a5cb7c7 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -5998,7 +5998,9 @@ static void test_effect_optimize(void) ID3D10EffectShaderVariable *gs; D3D10_TECHNIQUE_DESC tech_desc; ID3D10EffectTechnique *tech; + D3D10_PASS_DESC pass_desc; ID3D10EffectVariable *v; + ID3D10EffectPass *pass; ID3D10Effect *effect; ID3D10Device *device; ULONG refcount; @@ -6018,6 +6020,11 @@ static void test_effect_optimize(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(!strcmp(tech_desc.Name, "Render"), "Unexpected technique name %s.\n", tech_desc.Name);
+ pass = tech->lpVtbl->GetPassByIndex(tech, 0); + hr = pass->lpVtbl->GetDesc(pass, &pass_desc); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!strcmp(pass_desc.Name, "P0"), "Unexpected pass name %s.\n", pass_desc.Name); + v = effect->lpVtbl->GetVariableByName(effect, "g_so");
gs = v->lpVtbl->AsShader(v); @@ -6049,6 +6056,13 @@ static void test_effect_optimize(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(!tech_desc.Name, "Unexpected technique name %p.\n", tech_desc.Name);
+ hr = pass->lpVtbl->GetDesc(pass, &pass_desc); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!pass_desc.Name, "Unexpected pass name %p.\n", pass_desc.Name); + + pass = tech->lpVtbl->GetPassByName(tech, "P0"); + ok(!pass->lpVtbl->IsValid(pass), "Unexpected valid pass.\n"); + tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0); ok(tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");