vkd3d-shader: Consistently pass location structure by pointer.

This commit is contained in:
Nikolay Sivov
2023-04-14 09:02:14 +02:00
committed by Alexandre Julliard
parent 0ce55e8b8e
commit dfe923ea1d
Notes: Alexandre Julliard 2023-04-19 22:10:22 +02:00
Approved-by: Matteo Bruni (@Mystral)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/158
4 changed files with 132 additions and 129 deletions

View File

@@ -921,7 +921,7 @@ struct hlsl_ir_node *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *no
{
struct hlsl_ir_node *cast;
cast = hlsl_new_unary_expr(ctx, HLSL_OP1_CAST, node, *loc);
cast = hlsl_new_unary_expr(ctx, HLSL_OP1_CAST, node, loc);
if (cast)
cast->data_type = type;
return cast;
@@ -934,7 +934,7 @@ struct hlsl_ir_node *hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *no
}
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
const struct vkd3d_shader_location loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
const struct hlsl_reg_reservation *reg_reservation)
{
struct hlsl_ir_var *var;
@@ -944,7 +944,7 @@ struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct
var->name = name;
var->data_type = type;
var->loc = loc;
var->loc = *loc;
if (semantic)
var->semantic = *semantic;
var->storage_modifiers = modifiers;
@@ -969,7 +969,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *tem
hlsl_release_string_buffer(ctx, string);
return NULL;
}
var = hlsl_new_var(ctx, name, type, *loc, NULL, 0, NULL);
var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL);
hlsl_release_string_buffer(ctx, string);
if (var)
list_add_tail(&ctx->dummy_scope->vars, &var->scope_entry);
@@ -1192,11 +1192,11 @@ struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op
}
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_node *arg, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = {arg};
return hlsl_new_expr(ctx, op, operands, arg->data_type, &loc);
return hlsl_new_expr(ctx, op, operands, arg->data_type, loc);
}
struct hlsl_ir_node *hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op,
@@ -1256,12 +1256,12 @@ struct hlsl_ir_load *hlsl_new_load_index(struct hlsl_ctx *ctx, const struct hlsl
}
struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var,
struct vkd3d_shader_location loc)
const struct vkd3d_shader_location *loc)
{
struct hlsl_deref var_deref;
hlsl_init_simple_deref_from_var(&var_deref, var);
return hlsl_new_load_index(ctx, &var_deref, NULL, &loc);
return hlsl_new_load_index(ctx, &var_deref, NULL, loc);
}
struct hlsl_ir_load *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
@@ -1385,24 +1385,25 @@ struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *v
return &index->node;
}
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc)
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type,
const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_jump *jump;
if (!(jump = hlsl_alloc(ctx, sizeof(*jump))))
return NULL;
init_node(&jump->node, HLSL_IR_JUMP, NULL, &loc);
init_node(&jump->node, HLSL_IR_JUMP, NULL, loc);
jump->type = type;
return jump;
}
struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_location loc)
struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_loop *loop;
if (!(loop = hlsl_alloc(ctx, sizeof(*loop))))
return NULL;
init_node(&loop->node, HLSL_IR_LOOP, NULL, &loc);
init_node(&loop->node, HLSL_IR_LOOP, NULL, loc);
hlsl_block_init(&loop->body);
return loop;
}
@@ -1545,7 +1546,7 @@ static struct hlsl_ir_node *clone_jump(struct hlsl_ctx *ctx, struct hlsl_ir_jump
{
struct hlsl_ir_jump *dst;
if (!(dst = hlsl_new_jump(ctx, src->type, src->node.loc)))
if (!(dst = hlsl_new_jump(ctx, src->type, &src->node.loc)))
return NULL;
return &dst->node;
}
@@ -1570,7 +1571,7 @@ static struct hlsl_ir_node *clone_loop(struct hlsl_ctx *ctx, struct clone_instr_
{
struct hlsl_ir_loop *dst;
if (!(dst = hlsl_new_loop(ctx, src->node.loc)))
if (!(dst = hlsl_new_loop(ctx, &src->node.loc)))
return NULL;
if (!clone_block(ctx, &dst->body, &src->body, map))
{
@@ -1760,7 +1761,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx,
}
struct hlsl_buffer *hlsl_new_buffer(struct hlsl_ctx *ctx, enum hlsl_buffer_type type, const char *name,
const struct hlsl_reg_reservation *reservation, struct vkd3d_shader_location loc)
const struct hlsl_reg_reservation *reservation, const struct vkd3d_shader_location *loc)
{
struct hlsl_buffer *buffer;
@@ -1770,7 +1771,7 @@ struct hlsl_buffer *hlsl_new_buffer(struct hlsl_ctx *ctx, enum hlsl_buffer_type
buffer->name = name;
if (reservation)
buffer->reservation = *reservation;
buffer->loc = loc;
buffer->loc = *loc;
list_add_tail(&ctx->buffers, &buffer->entry);
return buffer;
}
@@ -3158,10 +3159,10 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name,
list_init(&ctx->buffers);
if (!(ctx->globals_buffer = hlsl_new_buffer(ctx, HLSL_BUFFER_CONSTANT,
hlsl_strdup(ctx, "$Globals"), NULL, ctx->location)))
hlsl_strdup(ctx, "$Globals"), NULL, &ctx->location)))
return false;
if (!(ctx->params_buffer = hlsl_new_buffer(ctx, HLSL_BUFFER_CONSTANT,
hlsl_strdup(ctx, "$Params"), NULL, ctx->location)))
hlsl_strdup(ctx, "$Params"), NULL, &ctx->location)))
return false;
ctx->cur_buffer = ctx->globals_buffer;

View File

@@ -1051,7 +1051,7 @@ struct hlsl_ir_node *hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_exp
struct hlsl_ir_node *arg2);
struct hlsl_ir_node *hlsl_new_bool_constant(struct hlsl_ctx *ctx, bool b, const struct vkd3d_shader_location *loc);
struct hlsl_buffer *hlsl_new_buffer(struct hlsl_ctx *ctx, enum hlsl_buffer_type type, const char *name,
const struct hlsl_reg_reservation *reservation, struct vkd3d_shader_location loc);
const struct hlsl_reg_reservation *reservation, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl,
const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_type *type,
@@ -1071,12 +1071,13 @@ struct hlsl_ir_node *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *cond
struct hlsl_block *then_block, struct hlsl_block *else_block, 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);
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc);
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type,
const struct vkd3d_shader_location *loc);
void hlsl_init_simple_deref_from_var(struct hlsl_deref *deref, struct hlsl_ir_var *var);
struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var,
struct vkd3d_shader_location loc);
const struct vkd3d_shader_location *loc);
struct hlsl_ir_load *hlsl_new_load_index(struct hlsl_ctx *ctx, const struct hlsl_deref *deref,
struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc);
struct hlsl_ir_load *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
@@ -1092,7 +1093,7 @@ bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index);
struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *val,
struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc);
struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_location loc);
struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc);
struct hlsl_ir_resource_load *hlsl_new_resource_load(struct hlsl_ctx *ctx,
const struct hlsl_resource_load_params *params, const struct vkd3d_shader_location *loc);
struct hlsl_ir_resource_store *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource,
@@ -1109,9 +1110,9 @@ struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
const struct vkd3d_shader_location *loc);
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);
const struct vkd3d_shader_location *loc);
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
const struct vkd3d_shader_location loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, unsigned int modifiers,
const struct hlsl_reg_reservation *reg_reservation);
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc,

File diff suppressed because it is too large Load Diff

View File

@@ -198,7 +198,7 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru
* can write the uniform name into the shader reflection data. */
if (!(uniform = hlsl_new_var(ctx, temp->name, temp->data_type,
temp->loc, NULL, temp->storage_modifiers, &temp->reg_reservation)))
&temp->loc, NULL, temp->storage_modifiers, &temp->reg_reservation)))
return;
list_add_before(&temp->scope_entry, &uniform->scope_entry);
list_add_tail(&ctx->extern_vars, &uniform->extern_entry);
@@ -212,7 +212,7 @@ static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct list *instrs, stru
temp->name = hlsl_strdup(ctx, name->buffer);
hlsl_release_string_buffer(ctx, name);
if (!(load = hlsl_new_var_load(ctx, uniform, temp->loc)))
if (!(load = hlsl_new_var_load(ctx, uniform, &temp->loc)))
return;
list_add_head(instrs, &load->node.entry);
@@ -238,7 +238,7 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir
}
new_semantic.index = semantic->index;
if (!(ext_var = hlsl_new_var(ctx, hlsl_strdup(ctx, name->buffer),
type, var->loc, &new_semantic, modifiers, NULL)))
type, &var->loc, &new_semantic, modifiers, NULL)))
{
hlsl_release_string_buffer(ctx, name);
hlsl_cleanup_semantic(&new_semantic);
@@ -278,7 +278,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
if (!(input = add_semantic_var(ctx, var, vector_type, modifiers, &semantic_copy, false)))
return;
if (!(load = hlsl_new_var_load(ctx, input, var->loc)))
if (!(load = hlsl_new_var_load(ctx, input, &var->loc)))
return;
list_add_after(&lhs->node.entry, &load->node.entry);
@@ -341,7 +341,7 @@ static void prepend_input_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
struct hlsl_ir_load *load;
/* This redundant load is expected to be deleted later by DCE. */
if (!(load = hlsl_new_var_load(ctx, var, var->loc)))
if (!(load = hlsl_new_var_load(ctx, var, &var->loc)))
return;
list_add_head(instrs, &load->node.entry);
@@ -437,7 +437,7 @@ static void append_output_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
struct hlsl_ir_load *load;
/* This redundant load is expected to be deleted later by DCE. */
if (!(load = hlsl_new_var_load(ctx, var, var->loc)))
if (!(load = hlsl_new_var_load(ctx, var, &var->loc)))
return;
list_add_tail(instrs, &load->node.entry);
@@ -523,11 +523,11 @@ static void insert_early_return_break(struct hlsl_ctx *ctx,
hlsl_block_init(&then_block);
if (!(load = hlsl_new_var_load(ctx, func->early_return_var, cf_instr->loc)))
if (!(load = hlsl_new_var_load(ctx, func->early_return_var, &cf_instr->loc)))
return;
list_add_after(&cf_instr->entry, &load->node.entry);
if (!(jump = hlsl_new_jump(ctx, HLSL_IR_JUMP_BREAK, cf_instr->loc)))
if (!(jump = hlsl_new_jump(ctx, HLSL_IR_JUMP_BREAK, &cf_instr->loc)))
return;
hlsl_block_add_instr(&then_block, &jump->node);
@@ -692,11 +692,11 @@ static bool lower_return(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *fun
list_move_slice_tail(&then_block.instrs, list_next(&block->instrs, &cf_instr->entry), tail);
lower_return(ctx, func, &then_block, in_loop);
if (!(load = hlsl_new_var_load(ctx, func->early_return_var, cf_instr->loc)))
if (!(load = hlsl_new_var_load(ctx, func->early_return_var, &cf_instr->loc)))
return false;
hlsl_block_add_instr(block, &load->node);
if (!(not = hlsl_new_unary_expr(ctx, HLSL_OP1_LOGIC_NOT, &load->node, cf_instr->loc)))
if (!(not = hlsl_new_unary_expr(ctx, HLSL_OP1_LOGIC_NOT, &load->node, &cf_instr->loc)))
return false;
hlsl_block_add_instr(block, not);
@@ -793,7 +793,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
list_add_before(&instr->entry, &store->node.entry);
}
if (!(load = hlsl_new_var_load(ctx, var, instr->loc)))
if (!(load = hlsl_new_var_load(ctx, var, &instr->loc)))
return false;
list_add_before(&instr->entry, &load->node.entry);
hlsl_replace_node(instr, &load->node);
@@ -1813,7 +1813,7 @@ static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
if (expr->op != HLSL_OP2_DIV)
return false;
if (!(rcp = hlsl_new_unary_expr(ctx, HLSL_OP1_RCP, expr->operands[1].node, instr->loc)))
if (!(rcp = hlsl_new_unary_expr(ctx, HLSL_OP1_RCP, expr->operands[1].node, &instr->loc)))
return false;
list_add_before(&expr->node.entry, &rcp->entry);
expr->op = HLSL_OP2_MUL;
@@ -1834,7 +1834,7 @@ static bool lower_sqrt(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *c
if (expr->op != HLSL_OP1_SQRT)
return false;
if (!(rsq = hlsl_new_unary_expr(ctx, HLSL_OP1_RSQ, expr->operands[0].node, instr->loc)))
if (!(rsq = hlsl_new_unary_expr(ctx, HLSL_OP1_RSQ, expr->operands[0].node, &instr->loc)))
return false;
list_add_before(&expr->node.entry, &rsq->entry);
expr->op = HLSL_OP1_RCP;
@@ -1911,7 +1911,7 @@ static bool lower_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *co
if (expr->op != HLSL_OP1_ABS)
return false;
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg, instr->loc)))
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg->entry);
@@ -1952,11 +1952,11 @@ static bool lower_round(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *
return false;
list_add_before(&instr->entry, &sum->entry);
if (!(frc = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, sum, instr->loc)))
if (!(frc = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, sum, &instr->loc)))
return false;
list_add_before(&instr->entry, &frc->entry);
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, frc, instr->loc)))
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, frc, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg->entry);
@@ -2028,7 +2028,7 @@ struct hlsl_ir_load *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *ins
return NULL;
list_add_tail(instrs, &iff->entry);
if (!(load = hlsl_new_var_load(ctx, var, condition->loc)))
if (!(load = hlsl_new_var_load(ctx, var, &condition->loc)))
return NULL;
list_add_tail(instrs, &load->node.entry);
@@ -2071,7 +2071,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &and->entry);
if (!(abs1 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg1, instr->loc)))
if (!(abs1 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg1, &instr->loc)))
return false;
list_add_before(&instr->entry, &abs1->entry);
@@ -2079,7 +2079,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &cast1->entry);
if (!(abs2 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg2, instr->loc)))
if (!(abs2 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg2, &instr->loc)))
return false;
list_add_before(&instr->entry, &abs2->entry);
@@ -2095,7 +2095,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &cast3->entry);
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, cast3, instr->loc)))
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, cast3, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg->entry);
@@ -2138,7 +2138,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &and->entry);
if (!(abs1 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg1, instr->loc)))
if (!(abs1 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg1, &instr->loc)))
return false;
list_add_before(&instr->entry, &abs1->entry);
@@ -2146,7 +2146,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &cast1->entry);
if (!(abs2 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg2, instr->loc)))
if (!(abs2 = hlsl_new_unary_expr(ctx, HLSL_OP1_ABS, arg2, &instr->loc)))
return false;
list_add_before(&instr->entry, &abs2->entry);
@@ -2162,7 +2162,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
return false;
list_add_before(&instr->entry, &cast3->entry);
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, cast3, instr->loc)))
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, cast3, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg->entry);
@@ -2192,7 +2192,7 @@ static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void
arg = expr->operands[0].node;
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg, instr->loc)))
if (!(neg = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg->entry);
@@ -2228,7 +2228,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
return false;
list_add_before(&instr->entry, &mul1->entry);
if (!(neg1 = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, mul1, instr->loc)))
if (!(neg1 = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, mul1, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg1->entry);
@@ -2237,7 +2237,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
ge->data_type = btype;
list_add_before(&instr->entry, &ge->entry);
if (!(neg2 = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg2, instr->loc)))
if (!(neg2 = hlsl_new_unary_expr(ctx, HLSL_OP1_NEG, arg2, &instr->loc)))
return false;
list_add_before(&instr->entry, &neg2->entry);
@@ -2258,7 +2258,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
return false;
list_add_before(&instr->entry, &mul2->entry);
if (!(frc = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, mul2, instr->loc)))
if (!(frc = hlsl_new_unary_expr(ctx, HLSL_OP1_FRACT, mul2, &instr->loc)))
return false;
list_add_before(&instr->entry, &frc->entry);