Nikolay Sivov : d3d10/effect: Implement SetRawValue().
Alexandre Julliard
julliard at winehq.org
Wed Oct 27 16:26:02 CDT 2021
Module: wine
Branch: master
Commit: 000767f92de2acf3a3a818da1fcdbaddea4f6c33
URL: https://source.winehq.org/git/wine.git/?a=commit;h=000767f92de2acf3a3a818da1fcdbaddea4f6c33
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Oct 26 23:25:16 2021 +0200
d3d10/effect: Implement SetRawValue().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d10/effect.c | 41 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 9f652680747..22a09f45e14 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -4514,9 +4514,36 @@ static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_varia
static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_SetRawValue(ID3D10EffectVariable *iface,
void *data, UINT offset, UINT count)
{
- FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count);
+ struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface);
+ BOOL is_buffer;
- return E_NOTIMPL;
+ TRACE("iface %p, data %p, offset %u, count %u.\n", iface, data, offset, count);
+
+ if (!iface->lpVtbl->IsValid(iface))
+ {
+ WARN("Invalid variable.\n");
+ return E_FAIL;
+ }
+
+ is_buffer = v->type->basetype == D3D10_SVT_CBUFFER || v->type->basetype == D3D10_SVT_TBUFFER;
+
+ if (v->type->type_class == D3D10_SVC_OBJECT && !is_buffer)
+ {
+ WARN("Not supported on object variables of type %s.\n",
+ debug_d3d10_shader_variable_type(v->type->basetype));
+ return D3DERR_INVALIDCALL;
+ }
+
+ if (!is_buffer)
+ {
+ offset += v->buffer_offset;
+ v = v->buffer;
+ }
+
+ memcpy(v->u.buffer.local_buffer + offset, data, count);
+ v->u.buffer.changed = TRUE;
+
+ return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
@@ -4524,7 +4551,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectV
{
struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface);
BOOL is_buffer;
- BYTE *src;
TRACE("iface %p, data %p, offset %u, count %u.\n", iface, data, offset, count);
@@ -4543,8 +4569,13 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectV
return D3DERR_INVALIDCALL;
}
- src = is_buffer ? v->u.buffer.local_buffer : v->buffer->u.buffer.local_buffer + v->buffer_offset;
- memcpy(data, src + offset, count);
+ if (!is_buffer)
+ {
+ offset += v->buffer_offset;
+ v = v->buffer;
+ }
+
+ memcpy(data, v->u.buffer.local_buffer + offset, count);
return S_OK;
}
More information about the wine-cvs
mailing list