Matteo Bruni : d3dx9: Implement ID3DXEffect::OnLostDevice().
Alexandre Julliard
julliard at winehq.org
Wed Mar 21 17:05:18 CDT 2018
Module: wine
Branch: master
Commit: 1bba7c5705da23586c39de98c764700c5a54fcc0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1bba7c5705da23586c39de98c764700c5a54fcc0
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Tue Mar 20 23:37:29 2018 +0100
d3dx9: Implement ID3DXEffect::OnLostDevice().
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/effect.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 55 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 340f3d3..33e0fc4 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -4328,13 +4328,65 @@ static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, struct IDire
return S_OK;
}
+static BOOL param_on_lost_device(void *data, struct d3dx_parameter *param)
+{
+ struct IDirect3DVolumeTexture9 *volume_texture;
+ struct IDirect3DCubeTexture9 *cube_texture;
+ struct IDirect3DTexture9 *texture;
+ D3DSURFACE_DESC surface_desc;
+ D3DVOLUME_DESC volume_desc;
+
+ if (param->class == D3DXPC_OBJECT && !param->element_count)
+ {
+ switch (param->type)
+ {
+ case D3DXPT_TEXTURE:
+ case D3DXPT_TEXTURE1D:
+ case D3DXPT_TEXTURE2D:
+ texture = *(IDirect3DTexture9 **)param->data;
+ if (!texture)
+ return FALSE;
+ IDirect3DTexture9_GetLevelDesc(texture, 0, &surface_desc);
+ if (surface_desc.Pool != D3DPOOL_DEFAULT)
+ return FALSE;
+ break;
+ case D3DXPT_TEXTURE3D:
+ volume_texture = *(IDirect3DVolumeTexture9 **)param->data;
+ if (!volume_texture)
+ return FALSE;
+ IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, 0, &volume_desc);
+ if (volume_desc.Pool != D3DPOOL_DEFAULT)
+ return FALSE;
+ break;
+ case D3DXPT_TEXTURECUBE:
+ cube_texture = *(IDirect3DCubeTexture9 **)param->data;
+ if (!cube_texture)
+ return FALSE;
+ IDirect3DTexture9_GetLevelDesc(cube_texture, 0, &surface_desc);
+ if (surface_desc.Pool != D3DPOOL_DEFAULT)
+ return FALSE;
+ break;
+ default:
+ return FALSE;
+ }
+ IUnknown_Release(*(IUnknown **)param->data);
+ *(IUnknown **)param->data = NULL;
+ }
+ return FALSE;
+}
+
static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
{
- struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
+ struct ID3DXEffectImpl *effect = impl_from_ID3DXEffect(iface);
+ struct d3dx9_base_effect *base = &effect->base_effect;
+ unsigned int i;
- FIXME("(%p)->(): stub\n", This);
+ TRACE("iface %p.\n", iface);
- return E_NOTIMPL;
+ for (i = 0; i < base->parameter_count; ++i)
+ walk_parameter_tree(&base->parameters[i].param, param_on_lost_device, NULL);
+
+ return D3D_OK;
}
static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
More information about the wine-cvs
mailing list