[PATCH vkd3d 06/17] vkd3d-shader/hlsl: Introduce add_load_index().

Zebediah Figura zfigura at codeweavers.com
Fri Jul 15 16:52:25 CDT 2022


On 7/14/22 20:23, Francisco Casas wrote:
> +struct hlsl_type *hlsl_get_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type,
> +        struct hlsl_ir_node *node)
> +{
> +    assert(node);
> +
> +    if (type->type == HLSL_CLASS_VECTOR)
> +        return hlsl_get_scalar_type(ctx, type->base_type);
> +
> +    if (type->type == HLSL_CLASS_MATRIX)
> +    {
> +        if (hlsl_type_is_row_major(type))
> +            return hlsl_get_vector_type(ctx, type->base_type, type->dimx);
> +        else
> +            return hlsl_get_vector_type(ctx, type->base_type, type->dimy);
> +    }
> +
> +    if (type->type == HLSL_CLASS_ARRAY)
> +        return type->e.array.type;
> +
> +    if (type->type == HLSL_CLASS_STRUCT)
> +    {
> +        struct hlsl_ir_constant *c = hlsl_ir_constant(node);
> +
> +        assert(c->value[0].u < type->e.record.field_count);
> +        return type->e.record.fields[c->value[0].u].type;
> +    }
> +
> +    assert(0);
> +    return NULL;
> +}

This is pretty ripe for a switch statement.



More information about the wine-devel mailing list