[PATCH 0/1] MR979: d3d9: Implement d3dx_effect_SetRawValue
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46012 Signed-off-by: Patrick Hibbs <hibbsncc1701(a)gmail.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/979
From: Patrick Hibbs <hibbsncc1701(a)gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46012 Signed-off-by: Patrick Hibbs <hibbsncc1701(a)gmail.com> --- dlls/d3dx9_36/effect.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 7719edd4f25..f82d69d1acd 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -4442,10 +4442,26 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic static HRESULT WINAPI d3dx_effect_SetRawValue(ID3DXEffect *iface, D3DXHANDLE parameter, const void *data, UINT byte_offset, UINT bytes) { - FIXME("iface %p, parameter %p, data %p, byte_offset %u, bytes %u stub!\n", + struct d3dx_effect *src = impl_from_ID3DXEffect( iface ); + struct d3dx_parameter *param = get_valid_parameter( src, parameter ); + void *raw = NULL; + + TRACE("iface %p, parameter %p, data %p, byte_offset %u, bytes %u.\n", iface, parameter, data, byte_offset, bytes); - return E_NOTIMPL; + if (!src) + { + WARN("Invalid variable.\n"); + return E_FAIL; + } + + if (!data || !param || !(raw = param_get_data_and_dirtify( src, param, + byte_offset + bytes, TRUE ))) + return D3DERR_INVALIDCALL; + + memcpy( raw, data, bytes ); + + return S_OK; } #endif -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/979
It would be nice to have some tests for this, checking that your implementation matches native behavior for both normal and edge cases (e.g. for the latter, what happens when data or param are NULL). You can probably use the last couple of tests at the end of d3dx9_36/tests/effect.c as reference. Also nitpick, the prefix in the commit subject should be "d3dx9:". -- https://gitlab.winehq.org/wine/wine/-/merge_requests/979#note_9969
participants (3)
-
Matteo Bruni (@Mystral) -
Patrick Hibbs -
Patrick Hibbs (@hibbsncc1701)