d3d10/effect: Implement SetRawValue().

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:
Nikolay Sivov 2021-10-26 23:25:16 +02:00 committed by Alexandre Julliard
parent 3f598171be
commit 000767f92d
1 changed files with 42 additions and 11 deletions

View File

@ -4513,18 +4513,9 @@ 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);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE d3d10_effect_variable_GetRawValue(ID3D10EffectVariable *iface,
void *data, UINT offset, UINT count)
{
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 +4534,48 @@ 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(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,
void *data, UINT offset, UINT count)
{
struct d3d10_effect_variable *v = impl_from_ID3D10EffectVariable(iface);
BOOL is_buffer;
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(data, v->u.buffer.local_buffer + offset, count);
return S_OK;
}