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

This commit is contained in:
Elizabeth Figura
2024-12-08 21:36:04 -06:00
committed by Henri Verbeet
parent 992d20def3
commit d5a2ff5c12
Notes: Henri Verbeet 2025-02-20 16:07:11 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Francisco Casas (@fcasas)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1370
3 changed files with 13 additions and 10 deletions

View File

@@ -1590,7 +1590,8 @@ 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_new_int_constant(struct hlsl_ctx *ctx, int32_t n, const struct vkd3d_shader_location *loc)
static struct hlsl_ir_node *hlsl_new_int_constant(struct hlsl_ctx *ctx, int32_t n,
const struct vkd3d_shader_location *loc)
{
struct hlsl_constant_value value;
@@ -1598,6 +1599,12 @@ struct hlsl_ir_node *hlsl_new_int_constant(struct hlsl_ctx *ctx, int32_t n, cons
return hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_INT), &value, loc);
}
struct hlsl_ir_node *hlsl_block_add_int_constant(struct hlsl_ctx *ctx, struct hlsl_block *block,
int32_t n, const struct vkd3d_shader_location *loc)
{
return append_new_instr(ctx, block, hlsl_new_int_constant(ctx, n, loc));
}
struct hlsl_ir_node *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
const struct vkd3d_shader_location *loc)
{