mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Write SM4 swizzle instructions.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
51b8c46b9d
commit
32fd18837b
@ -925,6 +925,26 @@ static void write_sm4_store(struct hlsl_ctx *ctx,
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_swizzle(struct hlsl_ctx *ctx,
|
||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_swizzle *swizzle)
|
||||
{
|
||||
struct sm4_instruction instr;
|
||||
unsigned int writemask;
|
||||
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
instr.opcode = VKD3D_SM4_OP_MOV;
|
||||
|
||||
sm4_register_from_node(&instr.dst.reg, &instr.dst.writemask, &swizzle->node);
|
||||
instr.has_dst = 1;
|
||||
|
||||
sm4_register_from_node(&instr.srcs[0].reg, &writemask, swizzle->val.node);
|
||||
instr.srcs[0].swizzle = hlsl_map_swizzle(hlsl_combine_swizzles(hlsl_swizzle_from_writemask(writemask),
|
||||
swizzle->swizzle, swizzle->node.data_type->dimx), instr.dst.writemask);
|
||||
instr.src_count = 1;
|
||||
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_shdr(struct hlsl_ctx *ctx,
|
||||
const struct hlsl_ir_function_decl *entry_func, struct dxbc_writer *dxbc)
|
||||
{
|
||||
@ -989,6 +1009,10 @@ static void write_sm4_shdr(struct hlsl_ctx *ctx,
|
||||
write_sm4_store(ctx, &buffer, hlsl_ir_store(instr));
|
||||
break;
|
||||
|
||||
case HLSL_IR_SWIZZLE:
|
||||
write_sm4_swizzle(ctx, &buffer, hlsl_ir_swizzle(instr));
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled instruction type %s.\n", hlsl_node_type_to_string(instr->type));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user