d3d10/effect: Implement IsOptimized().
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:
parent
099aa57f23
commit
2cc6b3092d
|
@ -256,6 +256,11 @@ struct d3d10_effect_anonymous_shader
|
|||
struct d3d10_effect_type type;
|
||||
};
|
||||
|
||||
enum d3d10_effect_flags
|
||||
{
|
||||
D3D10_EFFECT_OPTIMIZED = 0x1,
|
||||
};
|
||||
|
||||
/* ID3D10Effect */
|
||||
struct d3d10_effect
|
||||
{
|
||||
|
@ -282,6 +287,7 @@ struct d3d10_effect
|
|||
DWORD depthstencilview_count;
|
||||
DWORD used_shader_count;
|
||||
DWORD anonymous_shader_count;
|
||||
DWORD flags;
|
||||
|
||||
DWORD used_shader_current;
|
||||
DWORD anonymous_shader_current;
|
||||
|
|
|
@ -3531,6 +3531,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
|
|||
|
||||
FIXME("iface %p semi-stub!\n", iface);
|
||||
|
||||
if (effect->flags & D3D10_EFFECT_OPTIMIZED)
|
||||
return S_OK;
|
||||
|
||||
for (i = 0; i < effect->used_shader_count; ++i)
|
||||
{
|
||||
v = effect->used_shaders[i];
|
||||
|
@ -3561,14 +3564,18 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_Optimize(ID3D10Effect *iface)
|
|||
effect->techniques[i].name = NULL;
|
||||
}
|
||||
|
||||
effect->flags |= D3D10_EFFECT_OPTIMIZED;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static BOOL STDMETHODCALLTYPE d3d10_effect_IsOptimized(ID3D10Effect *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
struct d3d10_effect *effect = impl_from_ID3D10Effect(iface);
|
||||
|
||||
return FALSE;
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
return !!(effect->flags & D3D10_EFFECT_OPTIMIZED);
|
||||
}
|
||||
|
||||
const struct ID3D10EffectVtbl d3d10_effect_vtbl =
|
||||
|
|
|
@ -6017,6 +6017,7 @@ static void test_effect_optimize(void)
|
|||
ID3D10Device *device;
|
||||
ULONG refcount;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
if (!(device = create_device()))
|
||||
{
|
||||
|
@ -6051,9 +6052,15 @@ static void test_effect_optimize(void)
|
|||
ok(!!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
|
||||
ok(!!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
|
||||
|
||||
ret = effect->lpVtbl->IsOptimized(effect);
|
||||
ok(!ret, "Unexpected return value.\n");
|
||||
|
||||
hr = effect->lpVtbl->Optimize(effect);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
ret = effect->lpVtbl->IsOptimized(effect);
|
||||
ok(ret, "Unexpected return value.\n");
|
||||
|
||||
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");
|
||||
|
@ -6081,6 +6088,10 @@ static void test_effect_optimize(void)
|
|||
tech = effect->lpVtbl->GetTechniqueByName(effect, "Render");
|
||||
ok(!tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");
|
||||
|
||||
/* Already optimized */
|
||||
hr = effect->lpVtbl->Optimize(effect);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
effect->lpVtbl->Release(effect);
|
||||
|
||||
refcount = ID3D10Device_Release(device);
|
||||
|
|
Loading…
Reference in New Issue