diff --git a/libs/vkd3d-shader/msl.c b/libs/vkd3d-shader/msl.c index f1ca581f..f7261654 100644 --- a/libs/vkd3d-shader/msl.c +++ b/libs/vkd3d-shader/msl.c @@ -511,6 +511,21 @@ static void msl_endif(struct msl_generator *gen) vkd3d_string_buffer_printf(gen->buffer, "}\n"); } +static void msl_unary_op(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins, const char *op) +{ + struct msl_src src; + struct msl_dst dst; + uint32_t mask; + + mask = msl_dst_init(&dst, gen, ins, &ins->dst[0]); + msl_src_init(&src, gen, &ins->src[0], mask); + + msl_print_assignment(gen, &dst, "%s%s", op, src.str->buffer); + + msl_src_cleanup(&src, &gen->string_buffers); + msl_dst_cleanup(&dst, &gen->string_buffers); +} + static void msl_mov(struct msl_generator *gen, const struct vkd3d_shader_instruction *ins) { struct msl_src src; @@ -636,6 +651,9 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d case VKD3DSIH_MUL: msl_binop(gen, ins, "*"); break; + case VKD3DSIH_NOT: + msl_unary_op(gen, ins, "~"); + break; case VKD3DSIH_OR: msl_binop(gen, ins, "|"); break; diff --git a/tests/hlsl/cf-cond-types.shader_test b/tests/hlsl/cf-cond-types.shader_test index b21eb44c..ce49600a 100644 --- a/tests/hlsl/cf-cond-types.shader_test +++ b/tests/hlsl/cf-cond-types.shader_test @@ -124,8 +124,8 @@ float4 main() : sv_target [test] uniform 0 float4 -2.0 0.0 0.0 0.0 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 -0.0 0.0 0.0 0.0 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) diff --git a/tests/hlsl/conditional.shader_test b/tests/hlsl/conditional.shader_test index 6f2cb5d3..5385e291 100644 --- a/tests/hlsl/conditional.shader_test +++ b/tests/hlsl/conditional.shader_test @@ -87,10 +87,10 @@ float4 main() : sv_target [test] uniform 0 float -2 -todo(msl) draw quad +draw quad probe (0, 0) rgba (1, 2, 3, 4) uniform 0 float 10 -todo(msl) draw quad +draw quad probe (0, 0) rgba (10, 20, 30, 40) diff --git a/tests/hlsl/function-return.shader_test b/tests/hlsl/function-return.shader_test index 184b4fda..051c9edf 100644 --- a/tests/hlsl/function-return.shader_test +++ b/tests/hlsl/function-return.shader_test @@ -134,13 +134,13 @@ float4 main() : sv_target [test] uniform 0 float 0.1 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.2, 0.1, 0.2, 0.1) 1 uniform 0 float 0.5 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.5, 0.4, 1.0, 0.9) 1 uniform 0 float 0.9 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (1.0, 0.9, 1.0, 0.6) 1 [pixel shader] diff --git a/tests/hlsl/return.shader_test b/tests/hlsl/return.shader_test index 50668259..10249fbf 100644 --- a/tests/hlsl/return.shader_test +++ b/tests/hlsl/return.shader_test @@ -37,10 +37,10 @@ float4 main() : sv_target [test] uniform 0 float 0.2 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) uniform 0 float 0.8 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.5, 0.6, 0.7, 0.8) [pixel shader todo(sm<4)] @@ -89,13 +89,13 @@ void main(out float4 ret : sv_target) [test] uniform 0 float 0.1 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) 1 uniform 0 float 0.5 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.2, 0.3, 0.4, 0.5) 1 uniform 0 float 0.9 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.5, 0.6, 0.7, 0.8) 1 [pixel shader todo(sm<4)] @@ -115,13 +115,13 @@ void main(out float4 ret : sv_target) [test] uniform 0 float 0.1 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) 1 uniform 0 float 0.5 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.5, 0.6, 0.7, 0.8) 1 uniform 0 float 0.9 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0, 0) rgba (0.4, 0.5, 0.6, 0.7) 1 [pixel shader] diff --git a/tests/hlsl/unroll.shader_test b/tests/hlsl/unroll.shader_test index bc7cbe48..c7b3d9b8 100644 --- a/tests/hlsl/unroll.shader_test +++ b/tests/hlsl/unroll.shader_test @@ -19,7 +19,7 @@ float4 main() : sv_target [test] uniform 0 float 1 -todo(sm<4 | msl) draw quad +todo(sm<4) draw quad probe (0,0) rgba(10.0, 1.0, 2.0, 3.0) [pixel shader]