mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Introduce a hlsl_new_float_constant() helper.
This commit is contained in:
parent
15a0b44ada
commit
4c5fd9c7b9
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/22
@ -915,6 +915,17 @@ struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_typ
|
||||
return c;
|
||||
}
|
||||
|
||||
struct hlsl_ir_constant *hlsl_new_float_constant(struct hlsl_ctx *ctx, float f,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_constant *c;
|
||||
|
||||
if ((c = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_FLOAT), loc)))
|
||||
c->value[0].f = f;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
|
@ -758,6 +758,8 @@ struct hlsl_ir_expr *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *no
|
||||
struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
||||
const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_expr *hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *node);
|
||||
struct hlsl_ir_constant *hlsl_new_float_constant(struct hlsl_ctx *ctx,
|
||||
float f, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type,
|
||||
struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc);
|
||||
struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct vkd3d_shader_location loc);
|
||||
|
@ -3981,10 +3981,8 @@ primary_expr:
|
||||
{
|
||||
struct hlsl_ir_constant *c;
|
||||
|
||||
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
||||
if (!(c = hlsl_new_float_constant(ctx, $1, &@1)))
|
||||
YYABORT;
|
||||
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_FLOAT), @1);
|
||||
c->value[0].f = $1;
|
||||
if (!($$ = make_list(ctx, &c->node)))
|
||||
YYABORT;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user