mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Pass a hlsl_block pointer to hlsl_add_conditional().
This commit is contained in:
parent
80b9f52010
commit
7e7a6d3691
Notes:
Alexandre Julliard
2023-07-24 22:55:28 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/282
@ -1074,7 +1074,7 @@ struct vkd3d_string_buffer *hlsl_component_to_string(struct hlsl_ctx *ctx, const
|
||||
struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsigned int modifiers);
|
||||
const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type);
|
||||
|
||||
struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false);
|
||||
void hlsl_add_function(struct hlsl_ctx *ctx, char *name, struct hlsl_ir_function_decl *decl);
|
||||
bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, bool local_var);
|
||||
|
@ -2873,7 +2873,7 @@ static bool intrinsic_fmod(struct hlsl_ctx *ctx, const struct parse_initializer
|
||||
if (!(ge = add_binary_comparison_expr(ctx, params->instrs, HLSL_OP2_GEQUAL, div, zero, loc)))
|
||||
return false;
|
||||
|
||||
if (!(select = hlsl_add_conditional(ctx, block_to_list(params->instrs), ge, frac, neg_frac)))
|
||||
if (!(select = hlsl_add_conditional(ctx, params->instrs, ge, frac, neg_frac)))
|
||||
return false;
|
||||
|
||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, select, y, loc);
|
||||
@ -3036,7 +3036,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx,
|
||||
if (!(specular_pow = add_pow_expr(ctx, params->instrs, n_h, m, loc)))
|
||||
return false;
|
||||
|
||||
if (!(load = hlsl_add_conditional(ctx, block_to_list(params->instrs), specular_or, zero, specular_pow)))
|
||||
if (!(load = hlsl_add_conditional(ctx, params->instrs, specular_or, zero, specular_pow)))
|
||||
return false;
|
||||
|
||||
if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, load))
|
||||
@ -6449,7 +6449,7 @@ conditional_expr:
|
||||
if (!(second = add_implicit_conversion(ctx, block_to_list($1), second, common_type, &@5)))
|
||||
YYABORT;
|
||||
|
||||
if (!hlsl_add_conditional(ctx, block_to_list($1), cond, first, second))
|
||||
if (!hlsl_add_conditional(ctx, $1, cond, first, second))
|
||||
YYABORT;
|
||||
$$ = $1;
|
||||
}
|
||||
|
@ -2387,7 +2387,7 @@ static bool lower_casts_to_bool(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
return true;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_block *instrs,
|
||||
struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false)
|
||||
{
|
||||
struct hlsl_block then_block, else_block;
|
||||
@ -2413,11 +2413,11 @@ struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct list *ins
|
||||
|
||||
if (!(iff = hlsl_new_if(ctx, condition, &then_block, &else_block, &condition->loc)))
|
||||
return NULL;
|
||||
list_add_tail(instrs, &iff->entry);
|
||||
hlsl_block_add_instr(instrs, iff);
|
||||
|
||||
if (!(load = hlsl_new_var_load(ctx, var, &condition->loc)))
|
||||
return NULL;
|
||||
list_add_tail(instrs, &load->node.entry);
|
||||
hlsl_block_add_instr(instrs, &load->node);
|
||||
|
||||
return &load->node;
|
||||
}
|
||||
@ -2485,7 +2485,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
return false;
|
||||
hlsl_block_add_instr(block, neg);
|
||||
|
||||
return hlsl_add_conditional(ctx, &block->instrs, and, neg, cast3);
|
||||
return hlsl_add_conditional(ctx, block, and, neg, cast3);
|
||||
}
|
||||
|
||||
static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
@ -2547,7 +2547,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
return false;
|
||||
hlsl_block_add_instr(block, neg);
|
||||
|
||||
return hlsl_add_conditional(ctx, &block->instrs, and, neg, cast3);
|
||||
return hlsl_add_conditional(ctx, block, and, neg, cast3);
|
||||
}
|
||||
|
||||
static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
|
||||
@ -2669,7 +2669,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
return false;
|
||||
hlsl_block_add_instr(block, neg2);
|
||||
|
||||
if (!(cond = hlsl_add_conditional(ctx, &block->instrs, ge, arg2, neg2)))
|
||||
if (!(cond = hlsl_add_conditional(ctx, block, ge, arg2, neg2)))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < type->dimx; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user