vkd3d-shader/dxil: Emit double arithmetic operations when appropriate.

This commit is contained in:
Giovanni Mascellani 2024-09-24 13:59:58 +02:00 committed by Henri Verbeet
parent cf92d9f398
commit 3428ed7a64
Notes: Henri Verbeet 2024-10-08 22:11:48 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1158

View File

@ -4174,6 +4174,7 @@ static enum vkd3d_shader_opcode map_binary_op(uint64_t code, const struct sm6_ty
const struct sm6_type *type_b, struct sm6_parser *sm6) const struct sm6_type *type_b, struct sm6_parser *sm6)
{ {
bool is_int = sm6_type_is_bool_i16_i32_i64(type_a); bool is_int = sm6_type_is_bool_i16_i32_i64(type_a);
bool is_double = sm6_type_is_double(type_a);
bool is_bool = sm6_type_is_bool(type_a); bool is_bool = sm6_type_is_bool(type_a);
enum vkd3d_shader_opcode op; enum vkd3d_shader_opcode op;
bool is_valid; bool is_valid;
@ -4198,7 +4199,7 @@ static enum vkd3d_shader_opcode map_binary_op(uint64_t code, const struct sm6_ty
case BINOP_ADD: case BINOP_ADD:
case BINOP_SUB: case BINOP_SUB:
/* NEG is applied later for subtraction. */ /* NEG is applied later for subtraction. */
op = is_int ? VKD3DSIH_IADD : VKD3DSIH_ADD; op = is_int ? VKD3DSIH_IADD : (is_double ? VKD3DSIH_DADD : VKD3DSIH_ADD);
is_valid = !is_bool; is_valid = !is_bool;
break; break;
case BINOP_AND: case BINOP_AND:
@ -4214,7 +4215,7 @@ static enum vkd3d_shader_opcode map_binary_op(uint64_t code, const struct sm6_ty
is_valid = is_int && !is_bool; is_valid = is_int && !is_bool;
break; break;
case BINOP_MUL: case BINOP_MUL:
op = is_int ? VKD3DSIH_UMUL : VKD3DSIH_MUL; op = is_int ? VKD3DSIH_UMUL : (is_double ? VKD3DSIH_DMUL : VKD3DSIH_MUL);
is_valid = !is_bool; is_valid = !is_bool;
break; break;
case BINOP_OR: case BINOP_OR:
@ -4222,7 +4223,7 @@ static enum vkd3d_shader_opcode map_binary_op(uint64_t code, const struct sm6_ty
is_valid = is_int; is_valid = is_int;
break; break;
case BINOP_SDIV: case BINOP_SDIV:
op = is_int ? VKD3DSIH_IDIV : VKD3DSIH_DIV; op = is_int ? VKD3DSIH_IDIV : (is_double ? VKD3DSIH_DDIV : VKD3DSIH_DIV);
is_valid = !is_bool; is_valid = !is_bool;
break; break;
case BINOP_SREM: case BINOP_SREM: