d3d10/effect: Discard some of the shader metadata when optimizing an effect.

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-08-30 08:06:38 +03:00 committed by Alexandre Julliard
parent 87f099b7dc
commit 87ac914e82
2 changed files with 25 additions and 5 deletions

View file

@ -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)

View file

@ -5894,20 +5894,18 @@ static void test_effect_optimize(void)
ok(!!shaderdesc.NumOutputSignatureEntries, "Unexpected output 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, "Unexpected bytecode length.\n");
ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl);
ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
ok(!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
}
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);