[PATCH vkd3d 01/17] vkd3d-shader/hlsl: Store the struct fields as an array.

Henri Verbeet hverbeet at gmail.com
Mon Jul 18 09:29:49 CDT 2022


On Fri, 15 Jul 2022 at 03:24, Francisco Casas <fcasas at codeweavers.com> wrote:
> @@ -911,24 +903,22 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
>          return r;
>      if (t1->type == HLSL_CLASS_STRUCT)
>      {
> -        struct list *t1cur, *t2cur;
> -        struct hlsl_struct_field *t1field, *t2field;
> +        size_t i;
>
> -        t1cur = list_head(t1->e.elements);
> -        t2cur = list_head(t2->e.elements);
> -        while (t1cur && t2cur)
> +        if (t1->e.record.field_count != t2->e.record.field_count)
> +            return t1->e.record.field_count - t2->e.record.field_count;

This is perhaps unlikely to be an issue with any field counts seen in
practice, but we shouldn't use (modular) subtraction as comparison
function; see also commit 790ab754d5ac4fb1a723e16b22dbeea1a52a12b8.
Ideally we'd use a variant of vkd3d_u32_compare() here.



More information about the wine-devel mailing list