mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Use lower_ir() for lower_division().
This commit is contained in:
parent
ecd781e809
commit
496a3a2093
Notes:
Alexandre Julliard
2023-09-25 22:28:00 +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/334
@ -2268,10 +2268,10 @@ static bool sort_synthetic_separated_samplers_first(struct hlsl_ctx *ctx)
|
||||
}
|
||||
|
||||
/* Lower DIV to RCP + MUL. */
|
||||
static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
|
||||
static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
|
||||
{
|
||||
struct hlsl_ir_node *rcp, *mul;
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *rcp;
|
||||
|
||||
if (instr->type != HLSL_IR_EXPR)
|
||||
return false;
|
||||
@ -2281,10 +2281,12 @@ static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
|
||||
|
||||
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;
|
||||
hlsl_src_remove(&expr->operands[1]);
|
||||
hlsl_src_from_node(&expr->operands[1], rcp);
|
||||
hlsl_block_add_instr(block, rcp);
|
||||
|
||||
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, expr->operands[0].node, rcp)))
|
||||
return false;
|
||||
hlsl_block_add_instr(block, mul);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4423,7 +4425,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
||||
lower_ir(ctx, lower_ternary, body);
|
||||
if (profile->major_version < 4)
|
||||
{
|
||||
hlsl_transform_ir(ctx, lower_division, body, NULL);
|
||||
lower_ir(ctx, lower_division, body);
|
||||
hlsl_transform_ir(ctx, lower_sqrt, body, NULL);
|
||||
lower_ir(ctx, lower_dot, body);
|
||||
lower_ir(ctx, lower_round, body);
|
||||
|
Loading…
Reference in New Issue
Block a user