[PATCH vkd3d v2 04/10] vkd3d-shader/hlsl: Support initialization of implicit size arrays.

Giovanni Mascellani gmascellani at codeweavers.com
Tue May 10 08:33:04 CDT 2022


Hi,

I think this patch could go as it is now, but given that there will have 
to be another round...

Il 10/05/22 15:08, Giovanni Mascellani ha scritto:
>           for (i = 0; i < v->arrays.count; ++i)
> +        {
> +            if (v->arrays.sizes[i] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
> +            {
> +                if (type->type == HLSL_CLASS_OBJECT && shader_is_sm_5_1(ctx))
> +                {
> +                    if (i < v->arrays.count - 1)
> +                    {
> +                        hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
> +                                "Inner array size cannot be implicit.");
> +                    }
> +                    else
> +                    {
> +                        unbounded_res_array = true;
> +                    }
> +                }
> +                else
> +                {
> +                    hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE,
> +                            "Implicit size arrays not allowed in struct fields.");
> +                }
> +            }
>               field->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[i]);
> +        }
> +        if (unbounded_res_array)
> +        {
> +            hlsl_fixme(ctx, &v->loc, "Unbounded resource arrays as struct fields.");
> +            free_parse_variable_def(v);
> +            vkd3d_free(field);
> +            continue;
> +        }

I forgot to ask a question: why are you introducing this 
"unbounded_res_array" variable instead of calling hlsl_fixme() directly 
in the for loop?

Giovanni.



More information about the wine-devel mailing list