[PATCH] d3dcompiler: Parse type name strings.

Matteo Bruni matteo.mystral at gmail.com
Mon Jul 29 11:52:26 CDT 2019


On Fri, Jul 12, 2019 at 7:32 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>  dlls/d3dcompiler_43/reflection.c       | 16 ++++++++++++++++
>  dlls/d3dcompiler_43/tests/reflection.c | 12 +++++++-----
>  2 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
> index e492011c55f..050ddc47829 100644
> --- a/dlls/d3dcompiler_43/reflection.c
> +++ b/dlls/d3dcompiler_43/reflection.c
> @@ -51,6 +51,7 @@ struct d3dcompiler_shader_reflection_type
>
>      D3D11_SHADER_TYPE_DESC desc;
>      struct d3dcompiler_shader_reflection_type_member *members;
> +    char *name_string;
>  };

This is okay, an alternative is to use the same "char *name;" used in
all the other reflection structures.

> +    if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
> +    {
> +        read_dword(&ptr, &offset);
> +        if (!(type->name_string = heap_alloc(strlen(data + offset) + 1)))
> +        {
> +            ERR("Failed to allocate name memory.\n");
> +            heap_free(members);
> +            return E_OUTOFMEMORY;
> +        }
> +        strcpy(type->name_string, data + offset);
> +        desc->Name = type->name_string;
> +        TRACE("Name %s\n", debugstr_a(type->name_string));
> +    }
> +

This could be simplified a bit by making use of copy_name().



More information about the wine-devel mailing list