mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Store SM4 MOD in the vsir program.
This commit is contained in:
parent
30bc6965a2
commit
5df836c513
Notes:
Henri Verbeet
2024-11-06 23:02:23 +01:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1251
@ -8436,6 +8436,18 @@ static bool sm4_generate_vsir_instr_expr(struct hlsl_ctx *ctx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case HLSL_OP2_MOD:
|
||||||
|
switch (dst_type->e.numeric.type)
|
||||||
|
{
|
||||||
|
case HLSL_TYPE_UINT:
|
||||||
|
sm4_generate_vsir_expr_with_two_destinations(ctx, program, VKD3DSIH_UDIV, expr, 1);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
hlsl_fixme(ctx, &expr->node.loc, "SM4 %s modulus expression.", dst_type_name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
case HLSL_OP2_MUL:
|
case HLSL_OP2_MUL:
|
||||||
switch (dst_type->e.numeric.type)
|
switch (dst_type->e.numeric.type)
|
||||||
{
|
{
|
||||||
@ -8488,6 +8500,7 @@ static bool sm4_generate_vsir_instr_expr(struct hlsl_ctx *ctx,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
hlsl_fixme(ctx, &expr->node.loc, "SM4 %s expression.", debug_hlsl_expr_op(expr->op));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5032,29 +5032,6 @@ static void write_sm4_ret(const struct tpf_compiler *tpf)
|
|||||||
write_sm4_instruction(tpf, &instr);
|
write_sm4_instruction(tpf, &instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_sm4_binary_op_with_two_destinations(const struct tpf_compiler *tpf,
|
|
||||||
enum vkd3d_sm4_opcode opcode, const struct hlsl_ir_node *dst, unsigned int dst_idx,
|
|
||||||
const struct hlsl_ir_node *src1, const struct hlsl_ir_node *src2)
|
|
||||||
{
|
|
||||||
struct sm4_instruction instr;
|
|
||||||
|
|
||||||
memset(&instr, 0, sizeof(instr));
|
|
||||||
instr.opcode = opcode;
|
|
||||||
|
|
||||||
VKD3D_ASSERT(dst_idx < ARRAY_SIZE(instr.dsts));
|
|
||||||
sm4_dst_from_node(&instr.dsts[dst_idx], dst);
|
|
||||||
instr.dsts[1 - dst_idx].reg.type = VKD3DSPR_NULL;
|
|
||||||
instr.dsts[1 - dst_idx].reg.dimension = VSIR_DIMENSION_NONE;
|
|
||||||
instr.dsts[1 - dst_idx].reg.idx_count = 0;
|
|
||||||
instr.dst_count = 2;
|
|
||||||
|
|
||||||
sm4_src_from_node(tpf, &instr.srcs[0], src1, instr.dsts[dst_idx].write_mask);
|
|
||||||
sm4_src_from_node(tpf, &instr.srcs[1], src2, instr.dsts[dst_idx].write_mask);
|
|
||||||
instr.src_count = 2;
|
|
||||||
|
|
||||||
write_sm4_instruction(tpf, &instr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void write_sm4_ld(const struct tpf_compiler *tpf, const struct hlsl_ir_node *dst,
|
static void write_sm4_ld(const struct tpf_compiler *tpf, const struct hlsl_ir_node *dst,
|
||||||
const struct hlsl_deref *resource, const struct hlsl_ir_node *coords,
|
const struct hlsl_deref *resource, const struct hlsl_ir_node *coords,
|
||||||
const struct hlsl_ir_node *sample_index, const struct hlsl_ir_node *texel_offset,
|
const struct hlsl_ir_node *sample_index, const struct hlsl_ir_node *texel_offset,
|
||||||
@ -5269,39 +5246,6 @@ static void write_sm4_resinfo(const struct tpf_compiler *tpf, const struct hlsl_
|
|||||||
write_sm4_instruction(tpf, &instr);
|
write_sm4_instruction(tpf, &instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_sm4_expr(const struct tpf_compiler *tpf, const struct hlsl_ir_expr *expr)
|
|
||||||
{
|
|
||||||
const struct hlsl_ir_node *arg1 = expr->operands[0].node;
|
|
||||||
const struct hlsl_ir_node *arg2 = expr->operands[1].node;
|
|
||||||
const struct hlsl_type *dst_type = expr->node.data_type;
|
|
||||||
struct vkd3d_string_buffer *dst_type_string;
|
|
||||||
|
|
||||||
VKD3D_ASSERT(expr->node.reg.allocated);
|
|
||||||
|
|
||||||
if (!(dst_type_string = hlsl_type_to_string(tpf->ctx, dst_type)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (expr->op)
|
|
||||||
{
|
|
||||||
case HLSL_OP2_MOD:
|
|
||||||
switch (dst_type->e.numeric.type)
|
|
||||||
{
|
|
||||||
case HLSL_TYPE_UINT:
|
|
||||||
write_sm4_binary_op_with_two_destinations(tpf, VKD3D_SM4_OP_UDIV, &expr->node, 1, arg1, arg2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
hlsl_fixme(tpf->ctx, &expr->node.loc, "SM4 %s modulus expression.", dst_type_string->buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
hlsl_fixme(tpf->ctx, &expr->node.loc, "SM4 %s expression.", debug_hlsl_expr_op(expr->op));
|
|
||||||
}
|
|
||||||
|
|
||||||
hlsl_release_string_buffer(tpf->ctx, dst_type_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void write_sm4_if(struct tpf_compiler *tpf, const struct hlsl_ir_if *iff)
|
static void write_sm4_if(struct tpf_compiler *tpf, const struct hlsl_ir_if *iff)
|
||||||
{
|
{
|
||||||
struct sm4_instruction instr =
|
struct sm4_instruction instr =
|
||||||
@ -5857,10 +5801,6 @@ static void write_sm4_block(struct tpf_compiler *tpf, const struct hlsl_block *b
|
|||||||
case HLSL_IR_CONSTANT:
|
case HLSL_IR_CONSTANT:
|
||||||
vkd3d_unreachable();
|
vkd3d_unreachable();
|
||||||
|
|
||||||
case HLSL_IR_EXPR:
|
|
||||||
write_sm4_expr(tpf, hlsl_ir_expr(instr));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HLSL_IR_IF:
|
case HLSL_IR_IF:
|
||||||
write_sm4_if(tpf, hlsl_ir_if(instr));
|
write_sm4_if(tpf, hlsl_ir_if(instr));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user