mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Store SM4 DIV in the vsir program.
This commit is contained in:
parent
24f4308982
commit
e8b373e3ff
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
@ -8250,6 +8250,22 @@ static bool sm4_generate_vsir_instr_expr(struct hlsl_ctx *ctx,
|
|||||||
generate_vsir_instr_expr_single_instr_op(ctx, program, expr, VKD3DSIH_XOR, 0, 0, true);
|
generate_vsir_instr_expr_single_instr_op(ctx, program, expr, VKD3DSIH_XOR, 0, 0, true);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case HLSL_OP2_DIV:
|
||||||
|
switch (dst_type->e.numeric.type)
|
||||||
|
{
|
||||||
|
case HLSL_TYPE_FLOAT:
|
||||||
|
generate_vsir_instr_expr_single_instr_op(ctx, program, expr, VKD3DSIH_DIV, 0, 0, true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case HLSL_TYPE_UINT:
|
||||||
|
sm4_generate_vsir_expr_with_two_destinations(ctx, program, VKD3DSIH_UDIV, expr, 0);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
hlsl_fixme(ctx, &expr->node.loc, "SM4 %s division expression.", dst_type_name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
case HLSL_OP2_EQUAL:
|
case HLSL_OP2_EQUAL:
|
||||||
VKD3D_ASSERT(dst_type->e.numeric.type == HLSL_TYPE_BOOL);
|
VKD3D_ASSERT(dst_type->e.numeric.type == HLSL_TYPE_BOOL);
|
||||||
|
|
||||||
|
@ -5032,24 +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(const struct tpf_compiler *tpf, enum vkd3d_sm4_opcode opcode,
|
|
||||||
const struct hlsl_ir_node *dst, const struct hlsl_ir_node *src1, const struct hlsl_ir_node *src2)
|
|
||||||
{
|
|
||||||
struct sm4_instruction instr;
|
|
||||||
|
|
||||||
memset(&instr, 0, sizeof(instr));
|
|
||||||
instr.opcode = opcode;
|
|
||||||
|
|
||||||
sm4_dst_from_node(&instr.dsts[0], dst);
|
|
||||||
instr.dst_count = 1;
|
|
||||||
|
|
||||||
sm4_src_from_node(tpf, &instr.srcs[0], src1, instr.dsts[0].write_mask);
|
|
||||||
sm4_src_from_node(tpf, &instr.srcs[1], src2, instr.dsts[0].write_mask);
|
|
||||||
instr.src_count = 2;
|
|
||||||
|
|
||||||
write_sm4_instruction(tpf, &instr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dp# instructions don't map the swizzle. */
|
/* dp# instructions don't map the swizzle. */
|
||||||
static void write_sm4_binary_op_dot(const struct tpf_compiler *tpf, enum vkd3d_sm4_opcode opcode,
|
static void write_sm4_binary_op_dot(const struct tpf_compiler *tpf, enum vkd3d_sm4_opcode opcode,
|
||||||
const struct hlsl_ir_node *dst, const struct hlsl_ir_node *src1, const struct hlsl_ir_node *src2)
|
const struct hlsl_ir_node *dst, const struct hlsl_ir_node *src1, const struct hlsl_ir_node *src2)
|
||||||
@ -5320,22 +5302,6 @@ static void write_sm4_expr(const struct tpf_compiler *tpf, const struct hlsl_ir_
|
|||||||
|
|
||||||
switch (expr->op)
|
switch (expr->op)
|
||||||
{
|
{
|
||||||
case HLSL_OP2_DIV:
|
|
||||||
switch (dst_type->e.numeric.type)
|
|
||||||
{
|
|
||||||
case HLSL_TYPE_FLOAT:
|
|
||||||
write_sm4_binary_op(tpf, VKD3D_SM4_OP_DIV, &expr->node, arg1, arg2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HLSL_TYPE_UINT:
|
|
||||||
write_sm4_binary_op_with_two_destinations(tpf, VKD3D_SM4_OP_UDIV, &expr->node, 0, arg1, arg2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
hlsl_fixme(tpf->ctx, &expr->node.loc, "SM4 %s division expression.", dst_type_string->buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HLSL_OP2_DOT:
|
case HLSL_OP2_DOT:
|
||||||
switch (dst_type->e.numeric.type)
|
switch (dst_type->e.numeric.type)
|
||||||
{
|
{
|
||||||
@ -5890,6 +5856,7 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
|
|||||||
case VKD3DSIH_SAMPLE_INFO:
|
case VKD3DSIH_SAMPLE_INFO:
|
||||||
case VKD3DSIH_SINCOS:
|
case VKD3DSIH_SINCOS:
|
||||||
case VKD3DSIH_SQRT:
|
case VKD3DSIH_SQRT:
|
||||||
|
case VKD3DSIH_UDIV:
|
||||||
case VKD3DSIH_UGE:
|
case VKD3DSIH_UGE:
|
||||||
case VKD3DSIH_ULT:
|
case VKD3DSIH_ULT:
|
||||||
case VKD3DSIH_UMAX:
|
case VKD3DSIH_UMAX:
|
||||||
|
Loading…
Reference in New Issue
Block a user