Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 26 ++++++++++++++++++++++++-- dlls/d3d10/tests/effect.c | 4 +--- 2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 4f93f24600d..1a42b06f347 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -3225,9 +3225,31 @@ static struct ID3D10EffectTechnique * STDMETHODCALLTYPE d3d10_effect_GetTechniqu
static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface) { - FIXME("iface %p stub!\n", iface); + struct d3d10_effect *effect = impl_from_ID3D10Effect(iface); + struct d3d10_effect_variable *v; + unsigned int i;
- return E_NOTIMPL; + FIXME("iface %p semi-stub!\n", iface); + + for (i = 0; i < effect->used_shader_count; ++i) + { + v = effect->used_shaders[i]; + + if (v->u.shader.reflection) + { + v->u.shader.reflection->lpVtbl->Release(v->u.shader.reflection); + v->u.shader.reflection = NULL; + } + if (v->u.shader.bytecode) + { + ID3D10Blob_Release(v->u.shader.bytecode); + v->u.shader.bytecode = NULL; + } + heap_free(v->u.shader.stream_output_declaration); + v->u.shader.stream_output_declaration = NULL; + } + + return S_OK; }
static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface) diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 9ac3c6f314c..1dfe6180f0c 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -5894,20 +5894,18 @@ static void test_effect_optimize(void) ok(shaderdesc.NumOutputSignatureEntries != 0, "Unexpected input signature count.\n");
hr = effect->lpVtbl->Optimize(effect); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = gs->lpVtbl->GetShaderDesc(gs, 0, &shaderdesc); ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr); ok(!!shaderdesc.pInputSignature, "Expected input signature.\n"); ok(!shaderdesc.IsInline, "Unexpected inline flag.\n"); -todo_wine { ok(!shaderdesc.pBytecode, "Unexpected bytecode.\n"); ok(shaderdesc.BytecodeLength == 0, "Unexpected bytecode length.\n"); ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl); ok(shaderdesc.NumInputSignatureEntries == 0, "Unexpected input signature count.\n"); ok(shaderdesc.NumOutputSignatureEntries == 0, "Unexpected output signature count.\n"); -} + effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);