Zebediah Figura : vkd3d-shader: Write SM1 negation instructions.
Alexandre Julliard
julliard at winehq.org
Thu May 20 16:08:17 CDT 2021
Module: vkd3d
Branch: master
Commit: 3a9f547be3ea9db804b285db027c0c0e482ab558
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=3a9f547be3ea9db804b285db027c0c0e482ab558
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Tue May 18 15:55:25 2021 -0500
vkd3d-shader: Write SM1 negation instructions.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl_codegen.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 6491066..c2cedd2 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -1618,6 +1618,28 @@ static void write_sm1_binary_op(struct hlsl_ctx *ctx, struct bytecode_buffer *bu
write_sm1_instruction(ctx, buffer, &instr);
}
+static void write_sm1_unary_op(struct hlsl_ctx *ctx, struct bytecode_buffer *buffer,
+ D3DSHADER_INSTRUCTION_OPCODE_TYPE opcode, const struct hlsl_reg *dst,
+ const struct hlsl_reg *src, D3DSHADER_PARAM_SRCMOD_TYPE src_mod)
+{
+ const struct sm1_instruction instr =
+ {
+ .opcode = opcode,
+
+ .dst.type = D3DSPR_TEMP,
+ .dst.writemask = dst->writemask,
+ .dst.reg = dst->id,
+ .has_dst = 1,
+
+ .srcs[0].type = D3DSPR_TEMP,
+ .srcs[0].swizzle = swizzle_from_writemask(src->writemask),
+ .srcs[0].reg = src->id,
+ .srcs[0].mod = src_mod,
+ .src_count = 1,
+ };
+ write_sm1_instruction(ctx, buffer, &instr);
+}
+
static void write_sm1_constant_defs(struct hlsl_ctx *ctx, struct bytecode_buffer *buffer)
{
unsigned int i, x;
@@ -1745,6 +1767,10 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct bytecode_buffer *buffer,
write_sm1_binary_op(ctx, buffer, D3DSIO_MUL, &instr->reg, &arg1->reg, &arg2->reg);
break;
+ case HLSL_IR_UNOP_NEG:
+ write_sm1_unary_op(ctx, buffer, D3DSIO_MOV, &instr->reg, &arg1->reg, D3DSPSM_NEG);
+ break;
+
default:
FIXME("Unhandled op %u.\n", expr->op);
break;
More information about the wine-cvs
mailing list