[PATCH vkd3d v2 2/7] vkd3d-shader/hlsl: Make pre/post decrement generate a signed one.

Zebediah Figura (she/her) zfigura at codeweavers.com
Mon Nov 22 12:22:28 CST 2021


On 11/22/21 08:28, Giovanni Mascellani wrote:
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index 1eee4278..f6264fdd 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> @@ -553,6 +553,18 @@ struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir
>       return hlsl_new_store(ctx, lhs, NULL, rhs, 0, rhs->loc);
>   }
>   
> +struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
> +        const struct vkd3d_shader_location loc)
> +{
> +    struct hlsl_ir_constant *c;
> +
> +    if (!(c = hlsl_alloc(ctx, sizeof(*c))))
> +        return NULL;
> +    init_node(&c->node, HLSL_IR_CONSTANT, ctx->builtin_types.scalar[HLSL_TYPE_INT], loc);

We have hlsl_get_scalar_type() for this now.

> +    c->value[0].i = n;
> +    return c;
> +}
> +
>   struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
>           const struct vkd3d_shader_location loc)
>   {
> diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
> index 365ef980..3e7c906d 100644
> --- a/libs/vkd3d-shader/hlsl.h
> +++ b/libs/vkd3d-shader/hlsl.h
> @@ -718,6 +718,8 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *nam
>   struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format);
>   struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
>           const struct vkd3d_shader_location loc);
> +struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
> +        const struct vkd3d_shader_location loc);

Could you please keep these in alphabetical order?

>   struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
>           struct vkd3d_shader_location loc);
>   struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,



More information about the wine-devel mailing list