[PATCH 1/5] d3d10/effect: Move effect creation API functions.

Matteo Bruni matteo.mystral at gmail.com
Sun Sep 19 13:01:59 CDT 2021


On Thu, Sep 16, 2021 at 8:48 AM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
> ---
>  dlls/d3d10/d3d10_main.c | 53 -----------------------------------------
>  dlls/d3d10/effect.c     | 53 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 53 insertions(+), 53 deletions(-)

This patch just moves stuff around, which is great. There is the
chance for some small followups though.

> diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
> index e77d0691fcf..7342c2dbe23 100644
> --- a/dlls/d3d10/effect.c
> +++ b/dlls/d3d10/effect.c
> @@ -8360,3 +8360,56 @@ static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl =
>      d3d10_effect_type_GetMemberName,
>      d3d10_effect_type_GetMemberSemantic,
>  };
> +
> +static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry *entry)
> +{
> +    const struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, const struct d3d10_effect_type, entry);
> +    const DWORD *id = key;
> +
> +    return *id - t->id;
> +}
> +
> +HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT flags,
> +        ID3D10Device *device, ID3D10EffectPool *effect_pool, ID3D10Effect **effect)
> +{
> +    struct d3d10_effect *object;
> +    HRESULT hr;
> +
> +    FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n",
> +            data, data_size, flags, device, effect_pool, effect);

I guess we could make it a normal TRACE at this point.

> +
> +    if (!(object = heap_alloc_zero(sizeof(*object))))
> +    {
> +        ERR("Failed to allocate D3D10 effect object memory\n");
> +        return E_OUTOFMEMORY;
> +    }
> +
> +    wine_rb_init(&object->types, d3d10_effect_type_compare);
> +    object->ID3D10Effect_iface.lpVtbl = &d3d10_effect_vtbl;
> +    object->refcount = 1;
> +    ID3D10Device_AddRef(device);
> +    object->device = device;
> +
> +    hr = d3d10_effect_parse(object, data, data_size);
> +    if (FAILED(hr))
> +    {
> +        ERR("Failed to parse effect\n");
> +        IUnknown_Release(&object->ID3D10Effect_iface);
> +        return hr;
> +    }

ERR doesn't seem right, but you're fixing these two in patch 2/5 so
we're all good :)

> +
> +    *effect = &object->ID3D10Effect_iface;
> +
> +    TRACE("Created effect %p\n", object);
> +
> +    return S_OK;
> +}

While at it, we could add the period at the end of those messages.



More information about the wine-devel mailing list