vkd3d-shader/hlsl: Add a hlsl_block_add_float_constant() helper.

This commit is contained in:
Elizabeth Figura
2024-12-08 21:43:05 -06:00
committed by Henri Verbeet
parent e830cdee71
commit b7ea23303e
Notes: Henri Verbeet 2025-02-24 16:27:47 +01:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1386
4 changed files with 21 additions and 46 deletions

View File

@@ -1581,7 +1581,7 @@ struct hlsl_ir_node *hlsl_new_bool_constant(struct hlsl_ctx *ctx, bool b, const
return hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_BOOL), &value, loc);
}
struct hlsl_ir_node *hlsl_new_float_constant(struct hlsl_ctx *ctx, float f,
static struct hlsl_ir_node *hlsl_new_float_constant(struct hlsl_ctx *ctx, float f,
const struct vkd3d_shader_location *loc)
{
struct hlsl_constant_value value;
@@ -1590,6 +1590,12 @@ struct hlsl_ir_node *hlsl_new_float_constant(struct hlsl_ctx *ctx, float f,
return hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_FLOAT), &value, loc);
}
struct hlsl_ir_node *hlsl_block_add_float_constant(struct hlsl_ctx *ctx, struct hlsl_block *block,
float f, const struct vkd3d_shader_location *loc)
{
return append_new_instr(ctx, block, hlsl_new_float_constant(ctx, f, loc));
}
static struct hlsl_ir_node *hlsl_new_int_constant(struct hlsl_ctx *ctx, int32_t n,
const struct vkd3d_shader_location *loc)
{