mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Take writemask into account when emitting a SM4 constant.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a32f89c714
commit
c632ac7605
@ -1162,7 +1162,7 @@ static void write_sm4_constant(struct hlsl_ctx *ctx,
|
||||
{
|
||||
const unsigned int dimx = constant->node.data_type->dimx;
|
||||
struct sm4_instruction instr;
|
||||
unsigned int i;
|
||||
struct sm4_register *reg = &instr.srcs[0].reg;
|
||||
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
instr.opcode = VKD3D_SM4_OP_MOV;
|
||||
@ -1170,12 +1170,24 @@ static void write_sm4_constant(struct hlsl_ctx *ctx,
|
||||
sm4_register_from_node(&instr.dsts[0].reg, &instr.dsts[0].writemask, NULL, &constant->node);
|
||||
instr.dst_count = 1;
|
||||
|
||||
instr.srcs[0].reg.dim = (dimx > 1) ? VKD3D_SM4_DIMENSION_VEC4 : VKD3D_SM4_DIMENSION_SCALAR;
|
||||
instr.srcs[0].reg.type = VKD3D_SM4_RT_IMMCONST;
|
||||
instr.srcs[0].swizzle_type = VKD3D_SM4_SWIZZLE_NONE;
|
||||
reg->type = VKD3D_SM4_RT_IMMCONST;
|
||||
if (dimx == 1)
|
||||
{
|
||||
reg->dim = VKD3D_SM4_DIMENSION_SCALAR;
|
||||
reg->immconst_uint[0] = constant->value[0].u;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int i, j = 0;
|
||||
|
||||
for (i = 0; i < dimx; ++i)
|
||||
instr.srcs[0].reg.immconst_uint[i] = constant->value[i].u;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
if (instr.dsts[0].writemask & (1u << i))
|
||||
reg->immconst_uint[i] = constant->value[j++].u;
|
||||
}
|
||||
}
|
||||
instr.src_count = 1,
|
||||
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user