mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/msl: Implement VKD3DSIH_MOVC.
This commit is contained in:
parent
32a507ace6
commit
71ce43313f
Notes:
Henri Verbeet
2024-11-25 21:02:08 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1277
@ -440,6 +440,31 @@ static void msl_mov(struct msl_generator *gen, const struct vkd3d_shader_instruc
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void msl_movc(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
unsigned int component_count;
|
||||
struct msl_src src[3];
|
||||
struct msl_dst dst;
|
||||
uint32_t mask;
|
||||
|
||||
mask = msl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
msl_src_init(&src[0], gen, &ins->src[0], mask);
|
||||
msl_src_init(&src[1], gen, &ins->src[1], mask);
|
||||
msl_src_init(&src[2], gen, &ins->src[2], mask);
|
||||
|
||||
if ((component_count = vsir_write_mask_component_count(mask)) > 1)
|
||||
msl_print_assignment(gen, &dst, "select(%s, %s, bool%u(%s))",
|
||||
src[2].str->buffer, src[1].str->buffer, component_count, src[0].str->buffer);
|
||||
else
|
||||
msl_print_assignment(gen, &dst, "select(%s, %s, bool(%s))",
|
||||
src[2].str->buffer, src[1].str->buffer, src[0].str->buffer);
|
||||
|
||||
msl_src_cleanup(&src[2], &gen->string_buffers);
|
||||
msl_src_cleanup(&src[1], &gen->string_buffers);
|
||||
msl_src_cleanup(&src[0], &gen->string_buffers);
|
||||
msl_dst_cleanup(&dst, &gen->string_buffers);
|
||||
}
|
||||
|
||||
static void msl_ret(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
msl_print_indent(gen->buffer, gen->indent);
|
||||
@ -479,6 +504,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
|
||||
case VKD3DSIH_MOV:
|
||||
msl_mov(gen, ins);
|
||||
break;
|
||||
case VKD3DSIH_MOVC:
|
||||
msl_movc(gen, ins);
|
||||
break;
|
||||
case VKD3DSIH_MUL:
|
||||
msl_binop(gen, ins, "*");
|
||||
break;
|
||||
|
@ -25,7 +25,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 5.0 15.0 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (5.0, 5.0, -5.0, 3.0) 1
|
||||
|
||||
[pixel shader]
|
||||
@ -40,7 +40,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 42.0 5.0 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (2.0, -2.0, 2.0, -2.0) 16
|
||||
|
||||
[pixel shader]
|
||||
@ -55,7 +55,7 @@ float4 main() : SV_TARGET
|
||||
|
||||
[test]
|
||||
uniform 0 float4 45.0 5.0 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)
|
||||
|
||||
[pixel shader]
|
||||
@ -69,7 +69,7 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 5.0 -42.1 4.0 45.0
|
||||
uniform 4 float4 15.0 -5.0 4.1 5.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (5.0, -2.1, 4.0, 0.0) 6
|
||||
|
||||
[require]
|
||||
|
@ -8,10 +8,10 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 -0.5 6.5 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (-0.5, 0.0, 0.0, 0.0) 4
|
||||
uniform 0 float4 1.1 0.3 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.2, 0.0, 0.0, 0.0) 4
|
||||
|
||||
[pixel shader]
|
||||
@ -24,8 +24,8 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 -0.5 6.5 2.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (-0.5, 0.5, 0.0, 0.0) 4
|
||||
uniform 0 float4 1.1 0.3 3.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.1, 0.3, 0.0, 0.0) 4
|
||||
|
@ -13,10 +13,10 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 2.0 3.0 4.0 5.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (2.0, 3.0, 4.0, 5.0)
|
||||
uniform 0 float4 0.0 10.0 11.0 12.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (-1.0, 9.0, 10.0, 11.0)
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.1 3.0 4.0 5.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.1, 2.0, 0.0, 0.0)
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 1.0 0.0 0.0 0.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.5, 0.6, 0.7, 0.0)
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ float4 main() : sv_target
|
||||
uniform 0 float4 0.0 1.0 0.0 -3.0
|
||||
uniform 4 float4 1.0 2.0 3.0 4.0
|
||||
uniform 8 float4 5.0 6.0 7.0 8.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (5.0, 2.0, 7.0, 4.0)
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ float4 main() : sv_target
|
||||
uniform 0 float4 1.0 0.0 0.0 0.0
|
||||
uniform 4 float4 1.0 2.0 3.0 4.0
|
||||
uniform 8 float4 5.0 6.0 7.0 8.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0)
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ float4 main() : sv_target
|
||||
uniform 0 float4 1.0 0.0 1.0 0.0
|
||||
uniform 4 float4 1.0 2.0 3.0 4.0
|
||||
uniform 8 float4 5.0 6.0 7.0 8.0
|
||||
todo(msl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 5.0, 1.0, 5.0)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user