[v2 PATCH 10/10] d3d10/effect: Implement SetRawValue().
Matteo Bruni
mbruni at codeweavers.com
Tue Oct 26 16:25:16 CDT 2021
From: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
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;
}
--
2.26.3
More information about the wine-devel
mailing list