Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Add and use constant node creation helpers.

Merged Elizabeth Figura requested to merge zfigura/vkd3d:pr0 into master
4 files
+ 35
16
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 21
0
@@ -915,6 +915,27 @@ struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_typ
return c;
}
struct hlsl_ir_constant *hlsl_new_bool_constant(struct hlsl_ctx *ctx, bool b, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_constant *c;
if ((c = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, HLSL_TYPE_BOOL), loc)))
c->value[0].u = b ? ~0u : 0;
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)
{
Loading